<?php

namespace api\controller;

use common\controller\VerifyController;
use common\service\CategoryService;
use think\Request;
use think\Response;

class CategoryController extends VerifyController
{
    private $categoryService;

    public function __construct()
    {
        parent::__construct();
        $this->categoryService = CategoryService::getInstance();
    }

    /**
     * 获得分类树
     * @param Request $request
     * @return Response
     */
    public function getCategoryTree(Request $request)
    {
        $param = $request->param();
        $res = $this->categoryService->getCategoryTree($param['param']['filter']);
        return json(success_response("OK", $res));
    }
}
